package com.bondar.interfaces;

import java.util.Iterator;

import com.bondar.exceptions.MyIndexOutOfBoundsException;

@SuppressWarnings("rawtypes")
public interface MyList extends Iterable {
	/**
	 * This method add element to tail of the List
	 * 
	 * @param element
	 *            value that should be inserted
	 */
	public void add(Object element);

	/**
	 * This method add element at specified place in the List
	 * 
	 * @param index
	 *            value from 0 to size-1
	 * @param element
	 *            value that should be inserted
	 * @throws IndexOutOfBoundsException
	 *             if index < 0 or index > size-1
	 */
	public void add(int index, Object element) throws MyIndexOutOfBoundsException;

	/**
	 * This method appends all of the elements to the end of this list
	 * 
	 * @param arr
	 *            array of {@link Object}
	 * @throws NullPointerException
	 *             if arr == null
	 */
	public void addAll(Object[] arr);

	/**
	 * This method Inserts all of the elements into this list,<br>
	 * starting at the specified position
	 * 
	 * @param index
	 *            specified position
	 * @param arr
	 *            array of {@link Object}
	 * @throws NullPointerException
	 *             if arr == null
	 */
	public void addAll(int index, Object[] arr) throws MyIndexOutOfBoundsException;

	/**
	 * This method return object at specified position
	 * 
	 * @param index
	 *            position.
	 * @return object at specified position
	 * @throws IndexOutOfBoundsException
	 *             If index > data.length-1 or index < 0
	 */
	public Object get(int index) throws MyIndexOutOfBoundsException;

	/**
	 * This method remove object from list at specified position.
	 * 
	 * @param index
	 *            position.
	 * @return removed object
	 * @throws IndexOutOfBoundsException
	 *             if index > data.length-1 or index < 0
	 */
	public Object remove(int index) throws MyIndexOutOfBoundsException;

	/**
	 * Clear all elements list
	 */
	public void clear();
	
	/**
	 * Check if list is empty
	 * @return true if empty otherwise false
	 */
	public boolean isEmpty();
	
	
	/**
	 * This method change value of element at specified position
	 * 
	 * @param index
	 *            position
	 * @param element
	 * @throws IndexOutOfBoundsException
	 *             if index > data.length-1 or index < 0
	 */
	public void set(int index, Object element) throws MyIndexOutOfBoundsException;

	/**
	 * This method return position of element in the list.<br>
	 * Index starts from 0
	 * 
	 * @param element
	 * @return position of element in list or -1 otherwise
	 */
	public int indexOf(Object obj);

	/**
	 * Return size of the list
	 * @return 
	 */
	public int size();

	/**
	 * Return array of elements from this list
	 * @return
	 */
	public Object[] toArray();
	
	/**
	 * Return iterator
	 */
	public Iterator iterator();
}
